<template>
  <div class="hello">
    <div>
      <label>账号：</label>
      <input type="text" name="user" v-model="username">
      <label>密码：</label>
      <input type="password" name="pwd" v-model="password">
      <button type="button" id="btn" @click="login">登录</button>
    </div>
    <div>
      <Chat></Chat>
    </div>
  </div>
</template>

<script>
import axios from "axios";
import Chat from "./Chat";
export default {
  name: 'HelloWorld',
  // props: {
  //   msg: String,
  //   username:String,
  //   password:String
  // },
  components: {
    Chat
  },
  data(){
    return{
      username:"",
      password:"",

    }
  },
  methods:{
    login(){
      axios.get(`http://localhost:8089/toLogin?user=${this.username}&pwd=${this.password}`)
    },
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
  margin: 40px 0 0;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>